package com.wyr.common.annotation;

import org.springframework.core.annotation.AliasFor;

import java.lang.annotation.*;
import java.util.concurrent.TimeUnit;

/**
 * 限流注解
 *
 * @author wangyiren
 * @version 1.0
 * &#064;title RateLimiter
 * &#064;description
 * &#064;date 2025/03/06 10:42
 */
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD})
public @interface RateLimit {

    int NOT_LIMITED = 0;

    /**
     * qps
     */
    @AliasFor("qps") int value() default NOT_LIMITED;

    /**
     * qps
     */
    @AliasFor("value") int qps() default NOT_LIMITED;

    /**
     * 超时时长
     */
    int timeout() default 0;

    /**
     * 超时时间单位
     */
    TimeUnit timeUnit() default TimeUnit.MILLISECONDS;

}
